﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HQHS.Library.DAL.Administrator.Sprocs
{
    public class Administrator_Save_p : GOTCommandBase
    {
        private ParametersClass _params;
        public Administrator_Save_p()
        {
            SqlParameter p;

            this.SqlCommand.CommandText = "Administrator_Load_p";
            this.SqlCommand.CommandType = CommandType.StoredProcedure;

            p = this.SqlCommand.Parameters.Add("@RETURN_VALUE", SqlDbType.Int, 0);
            p.Direction = ParameterDirection.ReturnValue;
            p = this.SqlCommand.Parameters.Add("@ID", SqlDbType.Int, 0);
            p.Direction = ParameterDirection.InputOutput;
            this.SqlCommand.Parameters.Add("@UserName", SqlDbType.VarChar, 50);
            this.SqlCommand.Parameters.Add("@Password", SqlDbType.Char, 32);
            this.SqlCommand.Parameters.Add("@UserType", SqlDbType.TinyInt, 0);
            this.SqlCommand.Parameters.Add("@IsActive", SqlDbType.Bit, 0);
            this.SqlCommand.Parameters.Add("@LoginStatus", SqlDbType.TinyInt, 0);
            this.SqlCommand.Parameters.Add("@Type", SqlDbType.Int, 0);
        }

        #region  Public Properties
        public ParametersClass Parameters
        {
            get
            {
                if (_params == null)
                {
                    _params = new ParametersClass(this.SqlCommand);
                }
                return _params;
            }
        }
        #endregion

        #region  Parameters Class
        /// <summary>
        /// 
        /// </summary>
        public class ParametersClass
        {
            private SqlCommand _cmd;

            public ParametersClass(SqlCommand cmd)
            {
                _cmd = cmd;
            }

            public int? Return_Value
            {
                set
                {
                    if (value != null)
                    {
                        _cmd.Parameters["@Return_Value"].Value = value;
                    }
                    else
                    {
                        _cmd.Parameters["@Return_Value"].Value = System.DBNull.Value;
                    }
                }
            }
            public int ID
            {
                get
                {
                    return (int)_cmd.Parameters["@ID"].Value;
                }
                set
                {
                    _cmd.Parameters["@ID"].Value = value;
                }
            }
            public string UserName
            {
                set
                {
                    if (value != null)
                    {
                        _cmd.Parameters["@UserName"].Value = value;
                    }
                    else
                    {
                        _cmd.Parameters["@UserName"].Value = System.DBNull.Value;
                    }
                }
            }
            public string Password
            {
                set
                {
                    if (value != null)
                    {
                        _cmd.Parameters["@Password"].Value = value;
                    }
                    else
                    {
                        _cmd.Parameters["@Password"].Value = System.DBNull.Value;
                    }
                }
            }
            public bool? IsActive
            {
                set
                {
                    if (value != null)
                    {
                        _cmd.Parameters["@IsActive"].Value = value;
                    }
                    else
                    {
                        _cmd.Parameters["@IsActive"].Value = System.DBNull.Value;
                    }
                }
            }
            public byte? UserType
            {
                set
                {
                    if (value != null)
                    {
                        _cmd.Parameters["@UserType"].Value = value;
                    }
                    else
                    {
                        _cmd.Parameters["@UserType"].Value = System.DBNull.Value;
                    }
                }
            }
            public byte? LoginStatus
            {
                set
                {
                    if (value != null)
                    {
                        _cmd.Parameters["@LoginStatus"].Value = value;
                    }
                    else
                    {
                        _cmd.Parameters["@LoginStatus"].Value = System.DBNull.Value;
                    }
                }
            }
            public int? Type
            {
                set
                {
                    if (value != null)
                    {
                        _cmd.Parameters["@Type"].Value = value;
                    }
                    else
                    {
                        _cmd.Parameters["@Type"].Value = System.DBNull.Value;
                    }
                }
            }
        }
        #endregion
    }
}
